/********************************************************************************
 * Project Name		[JavaEE_Web]
 * File Name     	[TestServletLifeCycle.java]
 * Creation Date 	[2015-01-01]
 * 
 * Copyright© ge.y.yang@gmail.com All Rights Reserved
 * 
 * Work hard, play harder, think big and keep fit
 ********************************************************************************/
package servlet.other;

import java.io.IOException;

import javax.servlet.GenericServlet;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebServlet;

/**
 * 测试Servlet的生命周期
 * 
 * @author 不落的太阳(Sean Yang aka ShortPeace)
 * @version 1.0
 * @since jdk 1.8
 * 
 */
@WebServlet(name = "TestServletLifeCycle", urlPatterns = "/servletLifecycle")
public class TestServletLifeCycle extends GenericServlet {

	private static final long serialVersionUID = 7455846899314018695L;

	public TestServletLifeCycle() {
		System.out.println("创建Servlet");
	}

	@Override
	public void init() throws ServletException {
		System.out.println("初始化Servlet");
	}

	@Override
	public void service(ServletRequest request, ServletResponse response) throws ServletException, IOException {
		System.out.println("调用service方法");
	}

	@Override
	public void destroy() {
		System.out.println("销毁Servlet");
	}
}
